package export.magicWeapon
{
	
	import base.BaseBitmapDataClip;
	import base.BaseBitmapDataPool;
	import base.BaseHero;
	import base.BaseMagicWeapon;
	
	import com.game.data.vo.EquipmentVO;
	import com.greensock.TweenMax;
	
	import export.bullet.FollowTargetBullet;
	import export.bullet.SpecialEffectBullet;
	
	import flash.geom.Point;
	
	public class MagicFlag extends BaseMagicWeapon
	{
		
		public function MagicFlag(param1:BaseHero)
		{
			super(param1);
		}
		
		override protected function initBBDC():void
		{
			var _loc1_:* = null;
			var _loc2_:Array = BaseBitmapDataPool.getBitmapDataArrayByName("MagicFlagBmd");
			if (_loc2_)
			{
				_loc1_ = {
					"name"  : "body",
					"source": _loc2_
				};
				bbdc = new BaseBitmapDataClip([_loc1_], 100, 100, new Point(0, 0));
				bbdc.setOffsetXY(-20, -10);
				bbdc.setFrameStopCount([[6, 6, 6, 6, 6, 6], [9999]]);
				bbdc.setFrameCount([6, 1]);
				bbdc.setAddScriptWhenFrameOver(scriptFrameOverFunc);
				this.addChild(bbdc);
				return;
			}
			throw new Error("MagicFlag--BitmapData Error!");
		}
		
		override public function showSkill():void
		{
			var effect:FollowTargetBullet;
			var equip:EquipmentVO = null;
			var cd:int = 60;
			var bb:SpecialEffectBullet = new SpecialEffectBullet("MagicFlagStart");
			bb.x = this.x;
			bb.y = this.y;
			bb.setDisable();
			bb.setOwner(this.sourceRole);
			bb.setAction("idle");
			this.sourceRole.magicBulletArray.push(bb);
			gc.gameScene.addChild(bb);
			effect = new FollowTargetBullet("MagicFlagEffect");
			effect.x = this.sourceRole.x;
			effect.y = this.sourceRole.y;
			effect.setDestroyInCount(gc.frameClips * 10);
			effect.setIsDestroyWhenOwnerHurt(false);
			effect.setIsDestroyWhenLastFrame(false);
			effect.setOwner(this.sourceRole);
			effect.setDisable();
			effect.setDirect(0);
			effect.setAction("idle");
			this.sourceRole.magicBulletArray.push(effect);
			gc.gameScene.addChild(effect);
			if (this.sourceRole.getPlayer())
			{
				equip = this.sourceRole.getPlayer().getCurEquipByType("zbfb");
				if (equip)
				{
					if (equip.getFiveElementString().indexOf("木") != -1)
					{
						cd = 50;
					}
				}
			}
			TweenMax.delayedCall(cd, function (param1:MagicFlag):*
			{
				param1.setAction("idle");
			}, [this]);
		}
	}
}
